package com.yang.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yang.mapper.BillMapper;
import com.yang.pojo.Bill;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class BillServiceImpl implements BillService {
    @Autowired
    private BillMapper billMapper;

    public void setBillMapper(BillMapper billMapper) {
        this.billMapper = billMapper;
    }

    public List<Bill> queryAll() {
        return billMapper.queryAll();
    }

    public PageInfo<Bill> queryByBill(Bill bill, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Bill> bills = billMapper.queryByBill(bill);
        PageInfo<Bill> billPageInfo = new PageInfo<Bill>(bills);
        return billPageInfo;
    }

    public Integer save(Bill bill) {
        return billMapper.save(bill);
    }

    public Bill queryById(Integer id) {
        return billMapper.queryById(id);
    }

    public Integer delete(Integer id) {
        return billMapper.delete(id);
    }
}
